how to solve a system of equations with 3 variables